package com.woniuxy02;

import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;

/**
 * @author 作者
 * @create 2025-06-05 10:50
 */
public class Test07 {
    public static void main(String[] args) throws ParseException {
        //new SimpleDateFormat("YYYY-MM-dd")
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        TemporalAccessor temporalAccessor = dtf.parse("2012-01-12 12:13:14");
        System.out.println(temporalAccessor);
        LocalDateTime dateTime = LocalDateTime.from(temporalAccessor);
        System.out.println(dateTime);

        LocalDateTime dateTime1 = LocalDateTime.parse("2012-01-12 12:13:14", dtf);
        System.out.println(dateTime1);

    }


}
